package chapter7;

import java.util.Random;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/3/8 9:23
 */
class Value {
    int i;

    public Value(int i) {
        this.i = i;
    }
}

public class FinalData {
    public static final int VALUE_THREE = 39;
    private static final int VALUE_TWO = 99;
    private static final Value VAL_3 = new Value(33);
    private static Random random = new Random(47);
    static final int INT_5 = random.nextInt(20);
    private final int valueOne = 9;
    private final int i4 = random.nextInt(14);
    private final Value v2 = new Value(22);
    private final int[] a = {1, 2, 3, 4, 5, 6};
    private String id;
    private Value v1 = new Value(11);

    public FinalData(String id) {
        this.id = id;
    }

    public static void main(String[] args) {
        FinalData data = new FinalData("fd1");
        data.v2.i++;
        data.v1 = new Value(9);
        for (int i = 0; i < data.a.length; i++) {
            data.a[i]++;
        }

        System.out.println(data);
        System.out.println("Create new finalData");
        FinalData finalData = new FinalData("fd2");
        System.out.println(data);
        System.out.println(finalData);
    }

    @Override
    public String toString() {
        return id + ": " + " i4 = " + i4 + ". INT_5= " + INT_5;
    }
}
